package com.nuoniu.sibanyun.entity.cm;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.nuoniu.sibanyun.common.BaseEntity;
import com.nuoniu.sibanyun.entity.finance.VReceivePaymentDetail;
import com.nuoniu.sibanyun.entity.finance.VReceivePaymentPlan;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;

/**
 * <p>
 * 合同管理主表
 * </p>
 *
 * @author 小啊刚
 * @since 2021-10-21
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("cm_contract")
@ApiModel(value="CmContract对象", description="合同管理主表")
public class CmContract extends BaseEntity {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "账套id")
    @TableField("account_id")
    private Integer accountId;

    @ApiModelProperty(value = "租户id")
    @TableField("company_id")
    private Integer companyId;

    @ApiModelProperty(value = "租户名称")
    @TableField("company_name")
    private String companyName;

    @ApiModelProperty(value = "合同编号")
    @TableField("contract_code")
    private String contractCode;

    @ApiModelProperty(value = "合同名称")
    @TableField("contract_name")
    private String contractName;

    @ApiModelProperty(value = "合同金额")
    @TableField("contract_price")
    private BigDecimal contractPrice;

    @ApiModelProperty(value = "合同类型id")
    @TableField("contract_type_id")
    private Integer contractTypeId;

    @ApiModelProperty(value = "合同类型")
    @TableField("contract_type_name")
    private String contractTypeName;

    @ApiModelProperty(value = "收付款方向")
    @TableField("plan_direction")
    private Integer planDirection;

    @ApiModelProperty(value = "合同阶段分组id")
    @TableField("stage_group_id")
    private Integer stageGroupId;

    @ApiModelProperty(value = "合同阶段分组名称")
    @TableField("stage_group_name")
    private String stageGroupName;

    @ApiModelProperty(value = "我方签约人id")
    @TableField("sign_user_id")
    private Integer signUserId;

    @ApiModelProperty(value = "我方签约人名称")
    @TableField("sign_user_name")
    private String signUserName;

    @ApiModelProperty(value = "我方角色")
    @TableField("sign_role")
    private Integer signRole;

    @ApiModelProperty(value = "对方签约人")
    @TableField("opposite_signatory")
    private String oppositeSignatory;

    @ApiModelProperty(value = "对方单位id")
    @TableField("opposite_company_id")
    private Integer oppositeCompanyId;

    @ApiModelProperty(value = "对方单位")
    @TableField("opposite_company_name")
        private String oppositeCompanyName;

    @ApiModelProperty(value = "对方角色")
    @TableField("opposite_role")
    private Integer oppositeRole;

    @ApiModelProperty(value = "执行人id")
    @TableField("execute_user_id")
    private Integer executeUserId;

    @ApiModelProperty(value = "执行人姓名")
    @TableField("execute_user_name")
    private String executeUserName;

    @ApiModelProperty(value = "执行日期")
    @TableField("execute_date")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd" )
    private LocalDate executeDate;

    @ApiModelProperty(value = "审核人")
    @TableField("reviewer_user_id")
    private Integer reviewerUserId;

    @ApiModelProperty(value = "审核人姓名")
    @TableField("reviewer_user_name")
    private String reviewerUserName;

    @ApiModelProperty(value = "审核人日期")
    @TableField("reviewer_date")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd" )
    private LocalDate reviewerDate;

    @ApiModelProperty(value = "项目ID")
    @TableField("project_id")
    private Integer projectId;

    @ApiModelProperty(value = "项目编码")
    @TableField("project_no")
    private String projectNo;

    @ApiModelProperty(value = "项目名称")
    @TableField("project_name")
    private String projectName;

    @ApiModelProperty(value = "我方部门id")
    @TableField("office_id")
    private Integer officeId;

    @ApiModelProperty(value = "我方部门名称")
    @TableField("office_name")
    private String officeName;

    @ApiModelProperty(value = "签约日期")
    @TableField("signing_date")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd" )
    private LocalDate signingDate;

    @ApiModelProperty(value = "开始日期")
    @TableField("begin_date")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd" )
    private LocalDate beginDate;

    @ApiModelProperty(value = "结束日期")
    @TableField("end_date")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd" )
    private LocalDate endDate;

    @ApiModelProperty(value = "状态")
    @TableField("voucher_state")
    private Integer voucherState;

    @ApiModelProperty(value = "是否归档: 0否1是 ")
    @TableField("is_file")
    private Boolean isFile;

    @ApiModelProperty(value = "描述")
    @TableField("remarks")
    private String remarks;

    @ApiModelProperty(value = "创建人id")
    @TableField("create_user_id")
    private Integer createUserId;

    @ApiModelProperty(value = "创建人")
    @TableField("create_user_name")
    private String createUserName;

    @ApiModelProperty(value = "修改人id")
    @TableField("update_user_id")
    private Integer updateUserId;

    @ApiModelProperty(value = "修改人")
    @TableField("update_user_name")
    private String updateUserName;

    @ApiModelProperty(value = "创建时间")
    @TableField("create_date")
    private String createDate;

    @ApiModelProperty(value = "修改时间")
    @TableField("update_date")
    private LocalDateTime updateDate;

    @ApiModelProperty(value = "自定义字段")
    @TableField("define_fields")
    private String defineFields;

    @ApiModelProperty(value = "合同明细")
    @TableField(exist = false)
    private List<CmContractSubject> orderDetailList;

    @ApiModelProperty(value = "合同条款")
    @TableField(exist = false)
    private List<CmContractClause>  contractClauses;

    @ApiModelProperty(value = "收付信息")
    @TableField(exist = false)
    private List<VReceivePaymentPlan> receivePaymentPlans;

    @ApiModelProperty(value = "附件信息")
    @TableField(exist = false)
    private List<CmContractFile> contractFiles;

    @ApiModelProperty(value = "变更原因")
    @TableField(exist = false)
    private String changeCause;
}
